A coworker just showed me a MySQL query that gave him a pretty good scare yesterday.
mysql> SELECT COUNT(*) MISSION_CRITICAL_TABLE; +------------------------+ | MISSION_CRITICAL_TABLE | +------------------------+ | 0 | +------------------------+ 1 row in set (0.00 sec)
I did a double take when he showed it to me because I too missed the typo at first. That is a valid MySQL statement that means show me the count of nothing and call it MISSION_CRITICAL_TABLE. You see the 'AS' is optional. What he intended to type was:
mysql> SELECT COUNT(*) FROM MISSION_CRITICAL_TABLE; +----------+ | COUNT(*) | +----------+ | 7030295 | +----------+ 1 row in set (0.00 sec)
Okay, you can stop laughing at us now. I just thought that this was something that everyone who uses MySQL should be aware of.
Some ten years ago I an 'UPDATE PRODUCTION_TABLE SET FOO = "BAR"' query to "correct" a mistake that someone else had made. Notice the lack of the WHERE clause
I will never complain about having to add "FROM DUAL" in Oracle again!